package head.first.model.state.demo2;

/**
 * Created by yiyongyao on 2018/2/27.
 *
 * 糖果机状态 -- 未投币状态
 */
public class noQuarterState implements  State {

    GumballMachine gumballMachine;

    public noQuarterState(GumballMachine gumballMachine) {
        this.gumballMachine = gumballMachine;
    }

    @Override
    public void insertQuarter(GumballMachine gumballMachine) {
        System.out.println("投币成功!");
        gumballMachine.setState(gumballMachine.getHasQuarterState());

    }

    @Override
    public void ejectQuarter(GumballMachine gumballMachine) {
        System.out.println("未投币,无法退还钱币!");
    }

    @Override
    public void turnCrank(GumballMachine gumballMachine) {
        System.out.println("未投币,无法转动曲柄!");

    }

    @Override
    public void dispence(GumballMachine gumballMachine) {
        System.out.println("未投币,无法发放糖果!");

    }
}
